import xadmin

from apps.courses.models import Course, Lesson, Video, CourseResourse


class CourseAdmin(object):
    list_display = ['id', 'name', 'category', 'teacher', 'learn_times', 'degree', 'students', 'fav_nums']
    list_filter = ['category', 'teacher', 'degree']
    search_fields = ['name']
    list_per_page = 15


class LessonAdmin(object):
    list_display = ['id', 'name', 'course', 'learn_times']
    list_filter = ['course']
    search_fields = ['name']
    list_per_page = 15


class VideoAdmin(object):
    list_display = ['id', 'name', 'learn_times']
    search_fields = ['name']
    list_per_page = 15


class CourseResourseAdmin(object):
    list_display = ['id', 'name', 'course']
    search_fields = ['name']
    list_per_page = 15


xadmin.site.register(Course, CourseAdmin)
xadmin.site.register(Lesson, LessonAdmin)
xadmin.site.register(Video, VideoAdmin)
xadmin.site.register(CourseResourse, CourseResourseAdmin)
